package Controller.BankController;

import Utils.BaseMessage;
import Utils.isString;
import ViewOption.bankVo;
import com.alibaba.fastjson.JSON;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 修改银行名称
 */
@WebServlet(name = "updateAdminBankServlet", urlPatterns = {
        "/api/Bank/isAdmin/updateAdminBankServlet"
})
public class updateAdminBankServlet extends HttpServlet {
    private final bankVo bankVo = new bankVo();
    private final isString isString = new isString();

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        if (isString.IsEmpty(request.getParameter("bankName"), request.getParameter("bankId"))) {
            response.getWriter().print(JSON.toJSONString(new BaseMessage(2, "非法传参", null)));
            return;
        }
        response.getWriter().print(JSON.toJSONString(bankVo.updateBankIsAdminByBankId(request)));
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
